import React, { Component } from 'react'

export default class UseRefClass extends Component {
    state = {string:""}
    myRef = React.createRef()
    inputText= ()=>{
        this.setState(state => ({string:this.myRef.current.value}))
    }
    render() {
        return (
            <div>
                <button className='returnButton'><a href="/">点击返回主菜单</a></button>
                <h1>useRefClass</h1>
                <input type="text" ref={this.myRef} onChange={this.inputText} />
                <p>输入的内容为:{this.state.string}</p>
            </div>
        )
    }
}
